1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2       <tr align=center>
3         <td
class="title" width="100%" height="17">
4         Online : <b> <a href=
"./?act=online_m"><font color="#FFFFFF">Nh&#7853;p
5         m&#
7899;i</font></a><font color="#FFFFFF"> </font></b></td>
6       </tr>
7     </table>
8 <?
9     
switch ($_GET['action'])
10     {
11         
case 'del' :
12             $id = $_GET[
'id'];
13             $sql =
"delete from email where id='".$id."'";
14             @$result = mysql_query($sql,$con);
15             
if ($result) echo "<p align=center class='err'>&#272;ã xóa thành công</p>";
16             
else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</p>";
17             
break;
18     }
19 ?>
20
21 <?
22     
if (isset($_POST['ButDel'])) {
23         $cnt=
0;
24         
foreach ($_POST['chk'] as $id)
25         {
26             @$result = mysql_query(
"delete from email where id='".$id."'",$con);
27             
if ($result) $cnt++;
28         }
29         echo
"<p align=center class='err'>&#272;ã xóa ".$cnt." ph&#7847;n t&#7917;</p>";
30     }
31 ?>
32 <?
33     $page = $_GET[
"page"];
34     $MAXPAGE=
40;
35     $p=
0;
36     
if ($page!='') $p=$page;
37 ?>
38 <form method=
"POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
39 <input type=
"hidden" name="act" value="email">
40 <input type=hidden name=
"page" value="<? echo $page; ?>">
41 <?
42 function taotrang($sql,$link,$nitem,$itemcurrent)
43 {
global $con;
44     $ret=
"";
45     $result = mysql_query($sql, $con) or die(
'Error' . mysql_error());
46     $
value = mysql_fetch_array($result);
47     $plus = (($
value['cnt'] % $nitem)>0);
48     
for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
49     {
50         
if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
51         
else $ret .= ($i+1)." ";
52     }
53     
return $ret;
54 }
55     $pageindex=taotrang(
"select count(*) from email","./?act=email"."&page=",$MAXPAGE,$page);
56 ?>
57
58 <table cellspacing=
"0" cellpadding="0">
59 <tr>
60 <td
class="smallfont">Trang : <? echo $pageindex; ?></td>
61 </tr>
62 </table>
63
64 <table border=
"1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
65   <tr>
66     <td align=center nowrap
class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
67     <td nowrap
class="title">&nbsp;</td>
68     <td nowrap
class="title">&nbsp;</td>
69     <td align=
"center" nowrap class="title"><b>ID</b></td>
70     <td align=
"center" nowrap class="title"><b>Email</b></td>
71     <td align=
"center" nowrap class="title"><b>Ngày</b></td>
72   </tr>
73   
74   <?
75                 $sql=
"select * from email order by id limit ".($p*$MAXPAGE).",".$MAXPAGE;
76                 $result=mysql_query($sql,$con);
77                 $i=
0;
78                 
while(($row=mysql_fetch_array($result)))
79                 {
80                     $i++;
81                     
if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
82   ?>
83   
84   <tr>
85     <td width=
"20" align="center" bgcolor="<? echo $color; ?>" class="smallfont">
86     <input type=
"checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
87     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
88     </td>
89     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
90     <a onclick=
"return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" href="./?act=email&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">Xoá</a></td>
91     <td width=
"20" bgcolor="<? echo $color; ?>" align="left" width="55" align="left" class="smallfont"><? echo $row['id']; ?>&nbsp;</td>
92     <td width=
"80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['email']; ?>&nbsp;</td>
93     <td width=
"100" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['date']; ?>&nbsp;</td>
94   </tr>
95   <?
96                 }
97   ?>
98 </table>
99 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button" style="padding: 0">
100 </form>
101 <script language=
"JavaScript">
102 function chkallClick(o) {
103     
var form = document.frmList;
104     
for (var i = 0; i < form.elements.length; i++) {
105         
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
106             form.elements[i].
checked = document.frmList.chkall.checked;
107         }
108     }
109 }
110 </script>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.849 lượt xem

Gõ tìm kiếm nhanh...